//
//  KLTransform.m
//  KoalaUtilKit
//
//  Created by Tommy on 15/1/6.
//  Copyright (c) 2015年 Koala Team. All rights reserved.
//

#import "KLTransformer.h"
#import "ReactiveCocoa.h"

@implementation KLTransformer
+ (KLTransformer*)transformerWithBlock:(KLTransformBlock)block{
    return [[KLTransformer alloc]initWithBlock:block];
}

- (instancetype)initWithBlock:(KLTransformBlock)block{
    if(self = [super init]){
        _transformBlock = [block copy];
    }
    return self;
}

- (RACSignal *)transform:(id)object{
    return _transformBlock?_transformBlock(object):[RACSignal return:object];
}

@end
